//package com.xiaoluyy.demo.config;
//
//import com.xiaoluyy.service.md.MessageDrivenStarter;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class MessageDrivenConfig {
//
//    @Autowired
//    ApplicationContext context;
//
//    @Value("${kafka.zookeeper}")
//    String kafkaZookeeper;
//    @Value("${kafka.brokerList}")
//    String kafkaBrokerList;
//    @Value("${kafka.partitions}")
//    Integer kafkaPartitions;
//    @Value("${kafka.consumer.groupId}")
//    String kafkaConsumerGroupId;
//    @Value("${message.driven.scanPackages}")
//    String messageDrivenScanPackages;
//    @Value("${message.driven.workerThread}")
//    Integer messageDrivenWorkerThread;
//    @Value("${message.driven.publish.timeout}")
//    Long publishTimeout;
//
//    @Bean(initMethod = "start", destroyMethod = "stop")
//    public MessageDrivenStarter starter() throws Exception {
//        MessageDrivenStarter starter = new MessageDrivenStarter();
//        starter.setContext(context);
//        starter.setKafkaZookeeper(kafkaZookeeper);
//        starter.setKafkaBrokerList(kafkaBrokerList);
//        starter.setKafkaGroupId(kafkaConsumerGroupId);
//        starter.setScanPackages(messageDrivenScanPackages.split(","));
//        starter.setWorkerThread(messageDrivenWorkerThread);
//        starter.setKafkaPartitions(kafkaPartitions);
//        return starter;
//    }
//}
